<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>1</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

</head>
<body>
<script src="./js/jquery.js"></script>
<script src="https://unpkg.com/bootstrap-table@1.18.0/dist/bootstrap-table.min.js"></script>

<table
        id="table"
        class="table-hover"
        data-toggle="table"
        data-search="true">
    <thead class="thead-dark">
    <tr>
        <th data-field="id">ID</th>
        <th data-field="bookName">书名</th>
        <th data-field="borrowerId">借阅人ID</th>
        <th data-field="borrowTime">借阅时间</th>
        <th data-field="returnTime">归还时间</th>
        <th data-field="renewTimes">续借次数</th>
        <th data-field="bookId">书本ID</th>
    </tr>
    </thead>
</table>

<script>
    const token = document.cookie;
    $.ajax({
        url: "http://lenjon.top:9090/login", //请求url
        async: false,//有返回值才继续后面js
        type: "POST", //方式
        headers: {
            "Content-Type": "application/json;charset=utf8", //添加请求头，以后获取了token也要在这里加
            'Accept': '*/*',
            "token":token,
        },
        // crossDomain: true, //表示跨域
        dataType: "json", //限定返回类型 注意，get请求是jsonp
        success: function (data) { //请求成功则执行
            $("#table").bootstrapTable('load', data,{
                striped: true,                      //是否显示行间隔色
                sidePagination: "server",           //分页方式：client客户端分页，server服务端分页
                pageNumber:1,                       //初始化加载第一页，默认第一页
                pageSize: 10,                       //每页的记录行数（*）
                pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
            });
        },
        error: function () { //非必须，请求失败返回
            console.log('Request Error.');
        }

    });
</script>
</body>
</html>